<%@ page contentType="text/html; charset=UTF-8" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>扫码</title> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <script src="${pageContext.request.contextPath}/static/js/KeysManager/index.js"></script>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/KeysManager/AddLock.css?v=3">
    <link href="${pageContext.request.contextPath}/static/plugins/layer_mobile/need/layer.css" rel="stylesheet">
    <script src="${pageContext.request.contextPath}/static/js/jquery-1.11.3.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/KeysManager/VerifyCode.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/yahlj-app.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/layer_mobile/layer.js"></script>
    
</head>
<body>


<header class="bindTitle">
    <span>即将在手机APP上绑定账号信息</span>
    <br>
    <span>请输入确认信息</span>
</header>
	<input type="hidden" id='k' value='${k }'>
    <div class="content">

        <div class="item">

            <img class="icon" src="${pageContext.request.contextPath}/static/images/KeysManager/editName.png"/>
             <input type="text" name="user-name" id="user-name" class="edittext" placeholder="" value="${uname }" readOnly="true"/>
        </div>

      <%--   <div class="item">
            <img class="icon" src="${pageContext.request.contextPath}/static/images/KeysManager/key.png"/>
            <input type="text" name="lock-name" id="lock-name" class="edittext" placeholder="请输入智能锁名称" readOnly="true"/>
        </div> --%>

        <div class="item">

            <img class="icon" src="${pageContext.request.contextPath}/static/images/KeysManager/address.png"/>

			<input type="text" name="cityname" id="cityname" class="edittext" placeholder="" value="${cityname }" readOnly="true"/>

        </div>

  
        <div class="item">
            <input type="text" name="address" class="edittext" placeholder="" value="${addr }" readOnly="true"/>
        </div>
    </div>
    <div class="item">
        <img class="icon" src="${pageContext.request.contextPath}/static/images/KeysManager/telephone.png"/>
        <input type="text" class="edittext" placeholder="" id='tel' value="${tel}" readOnly="true"/>
    </div>

    <div class="verifty">
        <img class="icon" src="${pageContext.request.contextPath}/static/images/KeysManager/verification.png"/>
        <input type="text" class="inputVerify" id='code' placeholder="请输入验证码"/>
    </div>
    <div class="get-verify" id="send">发送验证码</div>

    <div class="foot">
        <button type="submit" name="enter" onclick="yes()" id="submit"> 确认</button>
        <button type="button" name="cancel" onclick="no()"  id="cancel" >取消</button>
    </div>


</body>
</html>
<script>

;(function(window, undefined){
	
	$("#sendCode").on('click',function(){
		var phonenum = $("#tel").val();
		$.post("${pageContext.request.contextPath}/admin/sendCode4BindApp.action", {
	     	'phone': phonenum
	      }, function (result) {
	          result = JSON.parse(result)
	          if (result.code == 1) {
	         	 showMsg(result.msg);
	         	  //addCookie("secondsremained",60,60);//添加cookie记录,有效时间60s
	              //settime(obj);//开始倒计时
	          }else{
	          	showMsg(result.msg);
	          }
	      });
	})
})(window);

function showMsg(content){
	layer.open({
	    content:content,
	    time:2
	});
}

	
function yes(){
	var k=$("#k").val();
	var code=$("#code").val();
	$.ajax({   
	    url:'<%=request.getContextPath()%>/admin/yesBindByQrcode.action',   
	    type:'post',
	    data:'k='+k+"&code="+code,   
	    async : true, //默认为true 异步   
	    dataType:'json',
	    error: function(XMLHttpRequest, textStatus, errorThrown) {
	    },  
	    success:function(result){   
	    	var data = result.data;
	       if(result.code=='1'){
	    	   showMsg(result.msg);
	       }else{
	    	   showMsg(result.msg);
	       }
	    }
	});
}


function no(){
	hljJs.closeWindow({
		success:function(res){
			console.log(res);		
		},
		fail:function(res){
			console.log(res);
		}
	});
}
</script>